package com.igda.tihbms.controllers;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

import com.igda.R;

public class ImagesController {

	private static final int SPRITES_QNT = 6;

	private static final int SHIP = 0;
	private static final int BULLET = SHIP + 1;
	private static final int ROCK = BULLET + 1;

	private final Bitmap[] sprites;

	public ImagesController() {
		this.sprites = new Bitmap[SPRITES_QNT];
	}

	public void init(Resources resources) {
		this.sprites[SHIP] = BitmapFactory.decodeResource(resources,
				R.drawable.animation_ship1_mov);
		this.sprites[BULLET] = BitmapFactory.decodeResource(resources,
				R.drawable.shoot_1);
		this.sprites[2] = BitmapFactory.decodeResource(resources,
				R.drawable.stone1);
		this.sprites[3] = BitmapFactory.decodeResource(resources,
				R.drawable.stone2);
		this.sprites[4] = BitmapFactory.decodeResource(resources,
				R.drawable.stone3);
	}

	public Bitmap getSprite(int pos) {
		return sprites[pos];
	}

	public Bitmap getShip() {
		return this.getSprite(SHIP);
	}

	public Bitmap getBullet() {
		return this.getSprite(BULLET);
	}

	public Bitmap getRock(int selectedRock) {
		return this.getSprite(ROCK + selectedRock);
	}

	public float getBulletWidth() {
		return this.getBullet().getWidth();
	}
}
